package com.dawn.webmagic.file.core.model;

import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.processor.PageProcessor;

/**
 * @author Ruffianjiang
 * @version V1.0
 * @Title: FilePageProcessor
 * @Package webmagic-demo
 * @date 2020/6/11 21:54
 */
public class FilePageProcessor implements PageProcessor {

    protected Logger logger = LoggerFactory.getLogger(getClass());

    /**
     * process the page, extract urls to fetch, extract the data and store
     *
     * @param page page
     */
    @Override
    public void process(Page page) {
        // 解析文件




        logger.info("FilePageProcessor {}", JSON.toJSONString(page));

    }

    /**
     * get the site settings
     *
     * @return site
     * @see Site
     */
    @Override
    public Site getSite() {
        return Site.me();
    }
}
